#ifndef _QUERY_H_
#define _QUERY_H_

#include <queue>

#include "Operator.h"

struct Query
{
	OperatorNode *node;

	Query *parent;
	std::vector <Query *> lists;	

	Query(OperatorNode *node);
	//Query(const Query &query);
	~Query();

	void addOperator(OperatorNode *node);
	void clear();

	void getOpsList(std::vector <OperatorNode *> &opsList);
	void setOpsList(std::vector <OperatorNode *> :: iterator it);
};

struct QueryInfo
{
	Query *query;
	int number;
	double cost;

	QueryInfo(Query *query, int number);
	~QueryInfo();
};

struct QueryStorage
{
	std::vector <QueryInfo *> queries;

	QueryStorage();
	~QueryStorage();

	void addQuery(QueryInfo *qi);

	void deleteQuery(QueryInfo *qi);
	void deleteQuery(int number);

	Query *getQuery(int number);

	bool empty();
	int size();
};

#endif
